﻿using System;
using System.Collections.Generic;
using System.Text;

namespace System
{
    /// <summary>
    /// 基本查询语句组合对象
    /// </summary>
    [Serializable]
    public class SqlInfo
    {
        public SqlInfo() : this("1=1")
        {           
        }

        public SqlInfo(string filter)
        {
            Filter = filter;
        }

        public SqlInfo(string primaryKey, string tableName) :this("1=1", primaryKey, tableName)
        {
 
        }       

        public SqlInfo(string filter, string primaryKey, string tableName) : this(filter)
        {
            TableName = tableName;
            PrimaryKey = primaryKey;
        }

        public SqlInfo(string fields, string filter, string sorts, string tableName, string primaryKey) : this(filter, primaryKey, tableName)
        {
            Fields = fields;
            Sorts = sorts;
        }

        public string Filter { get; set; }
        public string Sorts { get; set; }
        public string Fields { get; set; }

        public string TableName { get; set; }
        public string PrimaryKey { get; set; }  
    }
    
    /// <summary>
    /// 分页查询组合对象
    /// </summary>
    [Serializable]
    public class PageInfo : SqlInfo
    {
        public PageInfo():this("1=1", 1000000000, 0, -1)
        {                
        }

        public PageInfo(string filter, int pageSize, int pageIndex, int recordCount)
        {
            PageSize = pageSize;
            PageIndex = pageIndex;
            RecordCount = recordCount;        
        }

        public int PageSize { get; set; }
        public int PageIndex { get; set; }
        public int RecordCount { get; set; }
        
    }
}
